/*
 * LiteralTest.cpp
 *
 * Copyright 2012 Fabian Wenzelmann
 *
 * This file is part of Recognition-Procedures-for-Boolean-Functions.
 *
 * Recognition-Procedures-for-Boolean-Functions is free software: you
 * can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation,
 * either version 3 of the License, or (at your option) any later version.
 *
 * Recognition-Procedures-for-Boolean-Functions is distributed in the hope
 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
 * Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Recognition-Procedures-for-Boolean-Functions.
 *
 * If not, see <http://www.gnu.org/licenses/>.
 */

#include <gtest/gtest.h>

#include "bfr/Literal.hpp"


namespace bfr { namespace test {

TEST(Literal, string) {
    Literal l1(0);
    ASSERT_EQ("x0", l1.asString());

    Literal l2(1, false);
    ASSERT_EQ("~x1", l2.asString());
}

TEST(Literal, equals) {
    Literal l1(0, false);
    Literal l1Prime(0, false);

    Literal l1Pos(0);

    Literal l2(1, false);
    Literal l3(2);

    ASSERT_TRUE(l1 == l1Prime);
    ASSERT_FALSE(l1 == l1Pos);
    ASSERT_FALSE(l1 == l2);
    ASSERT_FALSE(l1 == l3);
}

TEST(Literal, hash) {
    Literal l1(0, false);
    Literal l1Prime(0, false);

    Literal l2(100);
    Literal l2Prime(100);

    ASSERT_EQ(l1.hashValue(), l1Prime.hashValue());
    ASSERT_EQ(l2.hashValue(), l2Prime.hashValue());
}

}}
